from django.conf.urls.defaults import patterns, include, url
#Adciona Genric View
from django.views.generic import list_detail, date_based, create_update
from iFriends.Quotes.models import Quote
from iFriends.People.models import Blog
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

quote_list_info = {
    'queryset' : Quote.objects.all(),
    'allow_empty' : True,
                   }
blog_detail_info = {
    'queryset' : Blog.objects.all(),
    'template_object_name' : 'blog',
    'template_name' : 'Blogs/blog_details.html',
                    }
blog_arch_info = {
    'queryset' : Blog.objects.all(),
    'date_field' : 'date',
    'template_name' : 'Blogs/blog_arch.html',
                  }
blog_month_info = {
    'queryset' : Blog.objects.all(),
    'date_field' : 'date',
    'template_name' : 'Blogs/blog_month.html',
                   }
blog_year_info = {
    'queryset' : Blog.objects.all(),
    'date_field' : 'date',
    'template_name' : 'Blogs/blog_year.html',
                  }

quote_add_info = {
    'model': Quote,
    'template_name': 'Quotes/quote_add.html',
    'post_save_redirect': '/generic/quote_list',
                  }

quote_update_info = {
    'model': Quote,
    'template_name': 'Quotes/quote_update.html',
    'post_save_redirect': '/generic/quote_list',
                     }

quote_delete_info = {
    'model': Quote,
    'template_name': 'Quotes/quote_delete.html',
    'post_delete_redirect': '/generic/quote_list',
                     }


urlpatterns = patterns('',
    
    (r'^$', 'iFriends.Home.views.home_view'),
    (r'^People/', include('iFriends.People.urls')),
    (r'^Blog/', include('iFriends.People.urls')),
    (r'^Home/contact/$', 'iFriends.Home.views.contact_view'),
    (r'^NewUser/$', 'iFriends.Home.views.create_user'),
    (r'^Login/$', 'iFriends.Home.views.login_user'),
    (r'^Logout/$', 'iFriends.Home.views.logout_user'),
    (r'^generic/quote_list/$', list_detail.object_list, quote_list_info),
    (r'^generic/quote_add/$', create_update.create_object ,quote_add_info),
    (r'^generic/quote_update/(?P<object_id>\d+)/$', create_update.update_object ,quote_update_info),
    (r'^generic/quote_delete/(?P<object_id>\d+)/$', create_update.delete_object ,quote_delete_info),
    (r'^generic/blog_details/(?P<object_id>\d+)/$', list_detail.object_detail, blog_detail_info),
    (r'^generic/blog_arch/(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 
        date_based.archive_month, blog_month_info),
    (r'^generic/blog_arch/(?P<year>\d{4})/$', 
        date_based.archive_year, blog_year_info),
    (r'^generic/blog_arch/$', date_based.archive_index, blog_arch_info),
        # url(r'^iFriends/', include('iFriends.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
     (r'^admin/view_log/(?P<evType>\w+)/$', 'iFriends.Custom.views.view_log'),
     (r'^admin/blog_usage/$', 'iFriends.Custom.views.blog_usage'),
     #(r'^admin/view_blog/view/$', 'iFriends.Custom.views.blog_usage'),
     url(r'^admin/', include(admin.site.urls)),

   
)





